﻿
using System;
using System.IO;

namespace MX.Core.Caching.Redis.Sider.Executors
{
	internal class ImmediateExecutor : ExecutorBase
	{
		public override Mode Mode { get { return Mode.Normal; } }

		public override T Execute<T> (Invocation<T>  invocation, Stream stream)
		{
			return execute (invocation, stream);
		}

		private T execute<T> (Invocation<T>  invocation, Stream stream)
		{
			try {
				return ExecuteImmediate (invocation, stream);
			} catch (Exception 
				ex) {
				if (!HandleTimeout (ex))
					throw; 
				throw new IdleTimeoutException (ex); 
			}
		}



	 
	}
}
